import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // 1 接收输入
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int n = input.nextInt();
        int mod = 998244353;

        // 2 使用高精度乘法计算总和
        // -1 计算总和
        StringBuilder answer = new StringBuilder();
        long carry = 0;
        for(int i = n; i >= 1; i--) {
            carry += (long)(a * i);
            answer.append(carry%10);
            carry /= 10;
        }
        if(carry != 0) {
            answer.append(new StringBuilder(""+carry).reverse());
        }
        answer.reverse();
        // -2 消除前置0（由于本题取值不可能为0，故无需消除前置0）

        // 3 使用高精度求模计算结果
        carry = 0;
        for(int i = 0; i < answer.length(); i++) {
            carry = (carry*10 + answer.charAt(i) - '0')%mod;
        }
        System.out.println(carry);
    }
}
